Output

char *diverge_model_to_file(diverge_model_t *mod, const char *fname)
[source]

output a diverge_model_t to a .dvg file that can be read using the diverge.output python library (see Simulation Output). more control can be obtained using diverge_model_to_file_finegrained() with the configuration structure diverge_model_output_conf_t. The defaults for this struct are given in diverge_model_output_conf_defaults (only accessible from C due to class/struct ditochtomy in C++), or diverge_model_output_conf_defaults_CPP(). functions return a checksum of the model as a string (must not be free’d as it is statically owned by libdivERGe)

Hint

if -DUSE_COMPRESSED_OUTPUT is enabled at compile time, the model output file will be zstd compressed. The Simulation Output library handles this automatically via zstd’s magic number.

file format specification info graphic (text below)

model output file specification

header is 128 elements of type index_t (64 bit signed integers)

all displacement/length information is in bytes

header[0]:

DIVERGE_MODEL_MAGIC_NUMBER

header[125-126]:

file format version string [displ, size]. if both are zero, default to v0.4 for diverge.output.read().

header[1-2]:

name [displ, size]

header[3]:

dim

header[4-6]:

nk

header[7-9]:

nkf

header[10-22]:

0 if patching == NULL, else:

header[10]:

n_patches

header[11-12]:

patches [displ, size]

header[13-14]:

weights [displ, size]

header[15-16]:

p_count [displ, size]

header[17-18]:

p_displ [displ, size]

header[19-20]:

p_map [displ, size]

header[21-22]:

p_weights [displ, size]

header[23-24]:

ibz_path [displ, size]

header[25]:

n_orb

header[26-34]:

lattice [interpret as double[3][3]]

header[35-36]:

positions [displ, size]

header[37]:

n_sym

header[38-39]:

orb_symmetries [displ, size]

header[40-41]:

rs_symmetries [displ, size]

header[42]:

n_hop

header[43-44]:

hop [displ, size]

header[45]:

SU2

header[46]:

n_spin

header[47]:

n_vert

header[48-49]:

vert [displ, size]

header[50]:

n_tu_ff

header[51-52]:

tu_ff [displ, size]

header[53-55]:

n_vert_chan

header[56-57]:

data [displ, size]

header[58-66]:

reciprocal latttice [interpret as double[3][3]]

by default all the following are zero. They can be controlled via the finegrained function diverge_model_to_file_finegrained()

header[80-81]:

kmesh [displ, size]

header[82-83]:

kfmesh [displ, size]

header[84-85]:

ham [displ, size]

header[86-87]:

U [displ, size]

header[88-89]:

E [displ, size]

header[90-91]:

kmesh ibz_path [displ, size]

header[92-93]:

kfmesh ibz_path [displ, size]

Both the kmesh and kfmesh ibz_path can only be calculated if ibz_path is set. These two objects require a bit of internal structure to be read correctly: The memory layout is:

N:

(number of segments, index_t)

lengh_segment_0 length_segment_N:

(index_t, N)

M:

(number of points, index_t)

index_point_0 index_point_M:

(index_t, M)

point_0_[x,y,z] point_M[x,y,z]:

(double, M, 3)

Note that [displ, size] accounts for the full displacement and size of the memory layout described above

header[97]:

nonzero if the actual header size is 256 * sizeof(int64_t). The extended header is currently unused, but this field is reserved for future extensions.

if ibz_path is set, else all the following are zero

header[98-99]:

fatbands [displ, size]

header[100-101]:

bandstructure [displ, size]

structure offest/size information, useful for python wrapping

header[102]:

offsetof(rs_hopping_t, R)

header[103]:

offsetof(rs_hopping_t, o1)

header[104]:

offsetof(rs_hopping_t, o2)

header[105]:

offsetof(rs_hopping_t, s1)

header[106]:

offsetof(rs_hopping_t, s2)

header[107]:

offsetof(rs_hopping_t, t)

header[108]:

sizeof(rs_hopping_t)

header[109]:

offsetof(rs_vertex_t, chan)

header[110]:

offsetof(rs_vertex_t, R)

header[111]:

offsetof(rs_vertex_t, o1)

header[112]:

offsetof(rs_vertex_t, o2)

header[113]:

offsetof(rs_vertex_t, s1)

header[114]:

offsetof(rs_vertex_t, s2)

header[115]:

offsetof(rs_vertex_t, s3)

header[116]:

offsetof(rs_vertex_t, s4)

header[117]:

offsetof(rs_vertex_t, V)

header[118]:

sizeof(rs_vertex_t)

header[119]:

offsetof(tu_formfactor_t, R[3])

header[120]:

offsetof(tu_formfactor_t, ofrom)

header[121]:

offsetof(tu_formfactor_t, oto)

header[122]:

offsetof(tu_formfactor_t, d)

header[123]:

offsetof(tu_formfactor_t, ffidx)

header[124]:

sizeof(tu_formfactor_t)

header[127]:

bit field (64bits) that is all zero when the numerical representations are correct. if not, errors are indicated in the following manner:

  • the leftmost (first) bit is one when floats are not 32bit wide

  • the second bit is one when doubles are not 64bit wide

  • the third bit is one when integers (int and index_t) are not little endian

  • the fourth bit is one when 1 byte (sizeof(char)) is not the same as 8 bit.

struct diverge_model_output_conf_t
[source]

to have fine-grained output control over diverge_model_to_file(). Used explicitly in diverge_model_to_file_finegrained(), and implicit in the python wrapper diverge.model_to_file_PY(). Defaults are not documented here, but can be obtained from C/C++/Python via diverge_model_output_conf_defaults_CPP() or from the static constant variable diverge_model_output_conf_defaults in C.

int kc
[source]

coarse kmesh

int kf
[source]

fine kmesh

int kc_ibz_path
[source]

include the indices on the coarse mesh that describe the ibz path. must have diverge_model_t.n_ibz_path > 0.

int kf_ibz_path
[source]

include the indices on the fine mesh that describe the ibz path. must have diverge_model_t.n_ibz_path > 0.

int H
[source]

Hamiltonian on fine mesh as array (k, orb, orb)

int U
[source]

Orbital to band matrices on fine mesh, ordered as (k, band, orb)

int E
[source]

energies on fine mesh; ordered as (k, band)

int npath
[source]

integer. use this as the number of points on the IBZ path (cf. diverge_model_output_set_npath()). Only used when nonzero; but then with precedence over what is/has been set in diverge_model_output_set_npath(). possible nonzero values: -1 (use eigenvalues on mesh), >=1 (explicitly calculate H from hoppings), <-1 (explcitly calculate H from hoppings in batched manner with this many pts). If INT_MIN skip the band structure output.

int fatbands
[source]

if (diverge_model_output_conf_t.npath == -1 && diverge_model_t.n_ibz_path > 0 && common internals are set), output the absolute value of the orbital to band matrices; ordering is (k, orbital, band), which stands in contrast to the internal ordering of orbital-band matrices (cf. diverge_model_internals_get_U())!

static const diverge_model_output_conf_t diverge_model_output_conf_defaults
[source]

output configuration defaults, accessible from C, for values look at source

diverge_model_output_conf_t diverge_model_output_conf_defaults_CPP(void)
[source]

return the defaults of the diverge_model_output_conf_t structure from CPP/Python. For C you can use a plain, simple

diverge_model_output_conf_t outconf = diverge_model_output_conf_defaults;
char *diverge_model_to_file_finegrained(diverge_model_t *mod, const char *fname, const diverge_model_output_conf_t *cfg)
[source]

offers the same functionality as diverge_model_to_file() including fine-grained controls over all internal structures. Returns the md5sum of the written file as static string.

Parameters:
char *diverge_model_to_file_fg(diverge_model_t *mod, const char *fname, const diverge_model_output_conf_t *cfg)
[source]

alias for diverge_model_to_file_finegrained()

void diverge_model_output_set_npath(int npath)
[source]

set the number of points per IBZ segment for the bandstructure calculation. defaults to DIVERGE_MODEL_NBANDSTRUCTURE (300). must be called before diverge_model_to_file(). If set to -1, use diverge_kmesh_to_bands() on the internal energy array and do not generate a band structure. requires common internals to be set (due to the energy array).